<template>
  <div class="rit">
    <div @click="ritselect" id="0">新建文件夹</div>
    <a :href="dlhref"><div @mousedown="ritselect" id="1">打开</div></a>
    <a :href="dlhref" :download="dlname"><div @mousedown="ritselect" id="2">下载</div></a>
    <div @click="ritselect" id="3">重命名</div>
    <div @click="ritselect" id="4">删除</div>
    <div @click="ritselect" id="5">属性</div>
  </div>
</template>

<script>
export default {
  props: ['dl'],
  data(){return{
    dlhref:null,
    dlname:null
  }},
  methods: {
    ritselect(e) {
      let id=e.toElement.id;
      //console.log(id);
      if (id==0){

      }else if(id==2){
      //  console.log(this.dl);
        this.dlhref=this.dlname=null;
        this.dlhref=this.dl.ph;
        this.dlname=this.dl.name;
      //  console.log(this.dlhref);
      }
    }
  }
}
</script>

<style >
.rit{
   border: 1px #999 solid;
   box-shadow: darkgrey 3px 3px 7px 1px;
   width: 100px;
   background: #fff;
}
.rit div{
  margin: 2px;
  padding-left: 5px;
  padding-top: 5px;
  padding-bottom: 5px;
  flex:1;
}
.rit a{
  text-decoration:none;
  color:#000;
}
.rit div:hover{
  background-color: #ddd;
}
</style>
